#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main()
{
	char c[105];
	char cmax[105] = "", cmin[105];
	memset(cmin, 'z', 90);
	for (int i = 0; i < 5; i++ )
	{
		scanf("%s", c);
		if (strcmp(c, cmax) > 0)
		{
			strcpy(cmax, c);
		}
		if (strcmp(c, cmin) < 0)
		{
			strcpy(cmin, c);
		}
	}
	printf("max:%s min:%s", cmax, cmin);
	return 0;
}
